package Day13_StringBuilder类;

/*
比较两个字符串:
            1.==是比较地址
            2.s1.equals(s2)      s1.equals("hello")
              equals是比较内容,相同返回true,不同返回false
              区分大小写!
            3.equalsIgnoreCase()
              s3.equalsIgnoreCase(s4),相同返回true,不同返回false
              不区分大小写!
*/
public class equals {
    public static void main(String[] args) {
        String s1 = "hello"; //方法区 字符串常量池
        String s2 = new String("hello");//堆内存
        System.out.println("s1==s2= " + (s1 == s2)); // false

        //boolean equals(0object an0object)    equals是比较内容,相同返回true,不同返回false
        System.out.println("s1.equals(s2)= " + s1.equals(s2)); //true

        String s3 = "Hello";
        String s4 = new String("hello");
        System.out.println("s3.equals(s4)= " + s3.equals(s4)); //false  区分大小写

        System.out.println("equalsIgnoreCase= "+s3.equalsIgnoreCase(s4)); //true  不区分大小写

    }
}
